<!-- @format -->

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
		<style>
			body {
				background: url(../images/20241111/desktop_1.jpg) no-repeat top
					center/cover;
			}
		</style>
	</head>

	<body>
		<script>
			// 要求：每次刷新，随机显示背景图片，图片范围desktop_1.jpg~desktop_10.jpg
			// console.log(document.body)

			// 取到 N ~ M 的随机整数
			function randomNum(n, m) {
				return Math.floor(Math.random() * (m - n + 1) + n);
			}

			// 随机数
			let num = randomNum(1, 10);
			// 修改body的背景样式
			document.body.style.background = `url(../images/20241111/desktop_${num}.jpg) no-repeat top
					center/cover`;
		</script>
	</body>
</html>
